package com.digital.smartgrow.service.title;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.digital.smartgrow.dao.title.LearningExperienceMapper;
import com.digital.smartgrow.dto.title.LearningExperience;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;

@Service
public class LearningExperienceServiceImpl implements LearningExperienceService{

    @Autowired
    LearningExperienceMapper learningExperienceMapper;

    @Override
    @Transactional
    public List<LearningExperience> findList(LearningExperience learningExperience) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("idcard", learningExperience.getIdcard());
        queryWrapper.eq("status", 0);
       return learningExperienceMapper.selectList(queryWrapper);
    }

    @Override
    @Transactional
    public void deleteCommend(LearningExperience learningExperience) {
        LearningExperience learningExperience1 = new LearningExperience();
        Date date = new Date();
        learningExperience1.setStatus(1).setId(learningExperience.getId()).setTime(date);
        learningExperienceMapper.updateById(learningExperience1);
    }
}
